<template>
  <ul class="menuList">

    <li style="display:flex;justify-content: space-around">
      <a @click='goUploadVdo'>
        <img src="../../image/upload.png" alt="">
        <span>会员上传视频</span>
      </a>
      <router-link to="/clinicAddress">
        <img src="../../image/jilei.png" alt="">
        <span style="right:40px">诊室认证</span>
      </router-link>
    </li>
    <li>
      <router-link to='/myCourse'>
        <img src="../../image/icon_studio_backstage.png" width="20" height="20" alt="">
        <h3>我的课程</h3>
        <img src="../../image/icon_gray_next.png" width="7" height="12" alt="">
      </router-link>
    </li>
    <li>
      <router-link to='/myCollect'>
        <img src="../../image/icon_studio_my.png" width="20" height="20" alt="">
        <h3>视频收藏</h3>
        <img src="../../image/icon_gray_next.png" width="7" height="12" alt="">
      </router-link>
    </li>
    <li>
      <router-link to="/myNews">
        <img src="../../image/icon_news_my.png" width="20" height="20" alt="">
        <h3>我的消息</h3>
        <img src="../../image/icon_gray_next.png" width="7" height="12" alt="">
      </router-link>
    </li>
    <li class="noBorder">
      <router-link to="/setting">
        <img src="../../image/icon_setting.png" width="20" height="20" alt="">
        <h3>设置</h3>
        <img src="../../image/icon_gray_next.png" width="7" height="12" alt="">
      </router-link>
    </li>
  </ul>
</template>
<script>
  export default {
    data() {
      return {
        userid: '',
        usertype: "", // 判断用户是否通过医师认证 如果通过就是doctor
        userroleid: '',
      }
    },
    methods: {
      justUserType() { //判断用户是否通过医生认证
        this.userid = localStorage.getItem("loginMobile");
        if (this.userid) {
          this.$api.get(this.$api.baseURLSchool, "select_cid/user/" + this.userid, {}, r => {
            if (r.data.ret == 1) {
              if (r.data.info.per_app_status == "1") {
                this.usertype = "doctor";
              }
              if (r.data.info.roleid == "live") {
                this.userroleid = "live";
              }
            }

          }, err => {
            console.log(err);
          })
        }

      },
      //创建直播课程 判断如果认证过了就可以创建 否则去认证页面
      goUploadVdo() {
        this.$router.push({
          name: 'uploadFile'
        });
      },
      // 我的诊室
      goMyClinic() {
        //判断用户是否认证 如果认证审核通过
        if (this.usertype == 'doctor') {
          this.$router.push({
            name: 'myClinic'
          });
        } else {
          this.$router.push({
            name: 'authentication'
          });
        }
      },
      // 我的直播间
      goMyLiveRoom() {
        //判断用户是否认证 如果认证审核通过
        if (this.userroleid == 'live') {
          this.$router.push({
            name: 'myLiveRoom'
          });
        } else {
          this.$router.push({
            name: 'authentication'
          });
        }
      }
    },
    created() {
      this.justUserType();
    }
  }

</script>
<style lang="scss" scoped>
  .menuList li:nth-last-of-type(-n+4) {
    box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2);
    margin: 10px 0px;
    border-radius: 5px;
    padding-right: 10px;
  }

  .menuList li:nth-last-of-type(-n+4) img {
    margin-left: 0.15rem !important;
  }

</style>
